<template>
	<view style="padding-top: 20upx;">
		<view v-for="(item,index) in res" :key="index" style="background: #fff;padding: 16upx 24upx;margin-bottom: 20upx;">
			<view class="webkit top">
				<view class="flex" style="color: #333;" v-cloak>提现： v-cloakitem.coinname}}</view>
				<view v-if="item.status == 0">待审核</view>
				<view v-else-if ="item.status == 1">审核通过</view>
				<view v-else-if ="item.status == 2">审核不通过</view>
				<view v-else-if ="item.status == 3">申请已取消</view>
			</view>
			<view class="center">
				<view v-cloak>提现数量：{{item.number}} 手续费：{{item.tbsxf}}</view>
				<view v-cloak>{{item.addtime}}</view>
			</view>
			<view class="webkit">
				<view class="flex" v-cloak>地址：{{item.address}}</view>
				<view class="webkit">
					<button style="background: #b0b0b0;" v-if="item.status == 0" @click="quxiao" :data-id="item.id">取消申请</button>
					<button @click="back" v-cloak>继续提现</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				res:[],
				openid:""
			};
		},
		onLoad:function(){
			uni.showLoading()
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data
					this.setAjax()
				},
				fail: () => {
					uni.navigateTo({
						url: '../login/login'
					});
				}
			});
		},
		methods:{
			setAjax(){
				uni.request({
					url: this.$BASE_URL+'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=coin.tbsqlist&app=1',
					method: 'POST',
					data: {'openid':this.openid},
					header:{'Content-Type':'application/x-www-form-urlencoded'},
					success: res => {
						console.log(res.data.list[0])
						uni.hideLoading()
						this.res = res.data.list
					},
					fail: () => {},
					complete: () => {}
				});
			},
			back(){
				uni.navigateBack();
			},
			quxiao(e){
				uni.showModal({
					content: "是否取消申请",
					confirmText: "确定",
					cancelText: "取消",
					success: res => {
						if(res.confirm){
							uni.request({
								url: this.$BASE_URL+'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=coin.status&app=1&id='+e.currentTarget.dataset.id,
								method: 'POST',
								data: {'openid':this.openid},
								header:{'Content-Type':'application/x-www-form-urlencoded'},
								success: res => {
									uni.showToast({
										title: '取消成功'
									});
									this.setAjax()
								},
								fail: () => {},
								complete: () => {}
							});
						}
					},
				})
			}
		}
	}
</script>

<style>
.top view{
	color: #999;
}
.center{
	border-bottom: 1px solid #eaeaea;
	padding-bottom: 10upx;
	margin-bottom: 16upx;
	}
.center view{
	font-size: 24upx;
	color: #666;
}
button{    
	font-size: 28upx;
    margin: 0;
    line-height: 50upx;
    height: 50upx;
    margin-left: 10upx;
    padding: 0 14upx;
    background: #04be02;
	color: #fff;
}
button:After{
	display: none;
}
</style>
